-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
【2人目確認中】[ 投稿リスト / 投稿リストスライダー ] 先頭固定表示の投稿の設定を追加 #2420
base: develop
Are you sure you want to change the base?
Conversation
@mtdkei どなたか2人目確認お願いします。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtdkei ありがとうございます!
動きは問題ないと思いました。コードレビュー細かいことですが2点ご確認ください。
@@ -217,6 +217,31 @@ public static function get_loop_query( $attributes ) { | |||
if ( ! empty( $date_query ) ) { | |||
$args['date_query'] = $date_query; | |||
} | |||
|
|||
$sticky_posts = isset( $attributes['stickyPosts'] ) ? $attributes['stickyPosts'] : 'include'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$sticky_posts という変数名が適切ではないと思います。
さらに234行目で$sticky_posts が再利用されているのもよろしくないので、別の変数名にしたいところです。
というか、221行目はわざわざ変数に入れず、223行目のswtich文で
switch ( $attributes['stickyPosts'] ?? 'include' ) {
と書けると思います。(たぶん)
そうすると再利用もなくなるすっきりします。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$sticky_posts というと固定記事がリストになっているものを思い浮かべますので、もし名前をつけるなら、$sticky_posts_mode とかそんな名前が良いと思います。
break; | ||
|
||
case 'exclude': | ||
$args['post__not_in'] = array_merge( $args['post__not_in'], get_option( 'sticky_posts' ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
次の行で $args['ignore_sticky_posts'] = true;
してるので、この行(229行目)は冗長で不要ではないでしょうか。
84b9485
to
9a35f91
Compare
@mthaichi 私の環境だけかもですが ?? にすると、プッシュの際に、PHP 5.6 だと動作しないというErrorが出たので、ご提案の$sticky_posts_modeという名前にしました。 また、だいぶ私が勘違いしていたのですが、ignore_sticky_posts のtrueとfalseは、先頭固定表示の投稿を無視して通常の並び順で表示をするかしないかっていうことに対してのものだったので、Excludeでは不必要でした。 そのほかも多少調整してみましたのでよろしくお願いいたします。 |
…ektor-inc/vk-blocks-pro into feature/post-list/sticky-posts
PHP7から使える記述なので、PHP5.6では使えないですねー。 あと、もう一つ気になる点を確認させてください。
$args['orderby'] = 'post__in' になってますが、これはどういう意図ですか? |
@mthaichi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtdkei 遅くなってすみません。問題ないと思いますので、このままマージします。
チケットへのリンク / 変更の理由(元のissueがあればリンクを貼り付ければOK)
#2288
#2366
どういう変更をしたか?
投稿リストと投稿リストスライダーで、クエリループブロックにあるような先頭固定表示の投稿を追加しました。
お一人の方にはコードのレビューもお願いできたらと思っております。
スクリーンショットまたは動画
変更前 Before
変更後 After
2025-01-24.17.39.15.mov
実装者の確認事項
実装者はレビュワーに回す前に以下の事を確認してチェックをつけてください。
プログラムの変更の場合
変更内容について何を確認したか、どういう方法で確認をしたかなど
Lighting、X-T9、TT5にて確認しました。また、分割読み込みのON、OFFを切り替えて確認しました。
レビュワーに回す前の確認事項
レビュワー確認方法・確認内容など
実装者と同じ確認を行ってください。
また、可能でしたら目視でのコードの確認をお願いいたします。
レビュワー向け
レビュワーが確認して変更が反映されていない場合の確認事項
レビューしてみて意図した動作をしない場合は再度ビルドするなど以下の項目を確認してください。